package com.itheima.controller;

import com.itheima.commons.Result;
import com.itheima.pojo.User;
import org.springframework.context.annotation.EnableAspectJAutoProxy;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
@RequestMapping("/user")
public class UserController {

    @RequestMapping("/login")
    @ResponseBody
    public Result login(@RequestBody User user){
        Result result=new Result();
        if("admin".equals(user.getUsername())&&"123".equals(user.getPassword())){
            result.setFlag(true);
            return result;
        }
        result.setFlag(false);
        result.setMessage("登录失败");
        return result;
    }
}
